home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d8 / tadex10.arc / EXECDOWN.SLT < prev    next >
Text File  |  1989-04-23  |  3KB  |  114 lines

  1. //                             EXECDOWN.SLT
  2. //                             Version 1.00
  3. //
  4. //                            By John Abatte
  5. //                            April 22, 1989
  6. //
  7. // This script will handle the download procedure. Currently it's only
  8. // set up for getting files from the "Mahoney IBM-DOS" collection. The
  9. // one item you may want to change is the name FILELIST.DAT in the
  10. // first line of the script. You can include a full path specification
  11. // if you want to put the file somewhere besides your Telix directory,
  12. // just be sure to increase the string length (the number between the
  13. // square braces [14]) to allow for a longer string. The default is just
  14. // to create the file in your Telix subdirectory.
  15.  
  16.  
  17. str fd[14] = "filelist.dat";
  18. str fn[20];
  19. str fc[20] = " ";
  20.  
  21. send_name(int fl)
  22. {
  23.  fgets(fn, 20, fl);                    // get a filename
  24.  if (!strcmpi(fn, fc))
  25.    {
  26.     return;
  27.    }
  28.  if (!waitfor("the BBS ->", 20))
  29.    {
  30.     tone(600, 30);
  31.     status_wind("Time out!", 8);
  32.     return;
  33.    }
  34.  strupper(fn);
  35.  status_wind(fn, 10);
  36.  delay(1);
  37.  cputs(fn);                            // send filename read in from file
  38.  cputs("^M");
  39.  fc = fn;
  40. }
  41.  
  42.  
  43. main()
  44. {
  45.  int fl;
  46.  int stat;
  47.  int tm;
  48.  int t1,t2,t3,t4;
  49.  
  50.  tm = timer_start(1800);               // wait up to 3 minutes
  51.  
  52.  t1  = track("WXG, ?=HELP) ->", 0);    // Main Menu
  53.  t2  = track(",Q,G,?=HELP) ->", 0);    // File Menu
  54.  t3  = track("from the BBS ->", 0);
  55.  t4  = track("OK? (YNG) ->", 0);
  56.  
  57.  while (!time_up (tm))
  58.    {
  59.     terminal();                        // let Telix process any chars and keys
  60.     stat = track_hit(0);               // see which (if any) track was hit
  61.  
  62.     if (stat == t1)                    // in case mail took more than 2 min
  63.       {
  64.        delay_scr(2);
  65.        cputc('f');
  66.        delay_scr(1);
  67.        cputc('a');
  68.       }
  69.     if (stat == t2)                    // open FILELIST.DAT for reading
  70.       {
  71.        flushbuf();
  72.        fl = fopen(fd, "r");
  73.        if (fl == 0)
  74.          {
  75.           tone(600,30);
  76.           status_wind("Error Opening File! Aborted",10);
  77.           prints("Error opening FILELIST.DAT! Aborting script!");
  78.           break;
  79.          }
  80.        cputc('d');                      // send download command
  81.        while (!feof (fl))                    // loop until end of file list
  82.          {
  83.           send_name(fl);
  84.          }
  85.       }
  86.     if (stat == t3)
  87.       {
  88.        delay_scr(2);
  89.        cputc('^M');                    // send <CR> when no more filenames
  90.       }
  91.     if (stat == t4)
  92.       {
  93.        delay_scr(2);
  94.        cputc('g');                     // GoodBye
  95.        break;                          // get out of loop
  96.       }
  97.    }
  98.  
  99.  fclose(fl);                           // Close file
  100.  
  101.  if (time_up(1))                       // force a hangup if script times out
  102.    {
  103.     prints("Download script aborting!");
  104.     hangup();
  105.    }
  106.  
  107.  timer_free(tm);                       // free timer channel
  108.  track_free(0);                        // and all track channels
  109.  capture("*CLOSE*");
  110.  
  111. }
  112.  
  113.  
  114.